<!DOCTYPE html>
<html lang="zh-cn">
<head>
{include file="public/header" /}
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong><span class="icon-menu"></span> 网站设置</strong></div>
  <div class="body-content">
    <form class="form-x" action="" id="basic">
      <div class="form-group">
        <div class="label">
          <label>标题：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="stitle" id="stitle" value="{$bas.title}" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>域名：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="domain" id="domain" value="{$bas.domain}" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>关键字：</label>
        </div>
        <div class="field">
          <textarea class="input" name="skeywords" oninput="skeywords()" id="skeywords" style="height:80px">{$bas.keywords}</textarea>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>管理员邮箱：</label>
        </div>
        <div class="field">
          <input type="text" name="email" id="email" class="input" value="{$bas.email}">
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>QQ：</label>
        </div>
        <div class="field">
          <input type="text" name="qq" id="qq" class="input" value="{$bas.qq}">
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>天气：</label>
        </div>
        <div class="field">
          <textarea class="input" name="abs" oninput="abs()" id="abs">{$bas.weather}</textarea>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>描述：</label>
        </div>
        <div class="field">
          <textarea class="input" name="sdescription" oninput="sdescription()" id="sdescription">{$bas.desc}</textarea>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>底部信息：</label>
        </div>
        <div class="field">
          <textarea name="scopyright" class="input" id="scopyright" oninput="scopyright()" style="height:120px;">{$bas.copy}</textarea>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-feiji" type="submit"> 提交</button>
        </div>
      </div>
    </form>
  </div>
</div>
<script type="text/javascript">
// 关键字
function skeywords(){
  var skeywords= document.getElementById("skeywords").value;
  return skeywords;
}
// 天气
function abs(){
  var abs= document.getElementById("abs").value;
  return abs;
}
// 描述
function sdescription(){
  var sdescription= document.getElementById("sdescription").value;
  return sdescription;
}
// 底部版权信息
function scopyright(){
  var scopyright= document.getElementById("scopyright").value;
  return scopyright;
}
  $(function(){
  $('#basic').validate({
    rules:{
      domain:{
        required:true,
      },
    },
    message:{
      domain: {
          required: "域名为必填项",
          minlength: "域名为必填项"
        },
    },
    onkeyup: false,
    focusCleanup: true,
    success: "valid",
    submitHandler:function(form){
      var title= $("#stitle").val();//标题
      var domain= $("#domain").val();//域名
      var keywords = skeywords();//关键字
      var email= $("#email").val();//管理员邮箱
      var qq= $("#qq").val();//管理员邮箱
      var tianqi= abs();//天启
      var desc= sdescription();//描述
      var copy= scopyright();//底部版权信息
      $.ajax({
        type:"POST",
        url:"{:url('info/up_info')}",
        data:{
          'id':1,
          'title':title,
          'domain':domain,
          'keywords':keywords,
          'email':email,
          'qq':qq,
          'weather':tianqi,
          'desc':desc,
          'copy':copy,
        },
        success:function(data){
          var data=eval("("+data+")");
          if (data.status) {
            parent.layer.msg("网站基础信息更新成功！",{icon:1,time:1000,},function(){parent.location.reload();});
          }else{
            parent.layer.msg("网站基础信息更新失败！",{icon:2,time:1000});
          }

        }
      })
    }
  })
})
</script>
</body></html>